// 基础折线图组件
import BaseLineChartComponent from "./base-line-chart.js";

class BasicLineChart extends BaseLineChartComponent {
    constructor() {
        super();
    }
    
    // 重写默认配置
    getDefaultConfig() {
        const config = super.getDefaultConfig();
        
        // 基础折线图特定配置
        config.titleAttrs = [
            ...config.titleAttrs,
            ['title-text_text', '基础折线图'],
            ['title-subtext_text', '基础折线展示']
        ];
        
        config.seriesAttrs = [
            ...config.seriesAttrs,
            ['series-smooth_radio', false],
            ['series-areastyle-show_radio', false],
            ['series-stack_radio', false]
        ];
        
        return config;
    }
    
    // 重写默认数据 - 多组数据展示
    getDefaultData() {
        return [
            {
                "销量": [
                    { "name": "1月", "value": 1200 },
                    { "name": "2月", "value": 1900 },
                    { "name": "3月", "value": 1500 },
                    { "name": "4月", "value": 2400 },
                    { "name": "5月", "value": 1800 },
                    { "name": "6月", "value": 3000 }
                ]
            },
            {
                "产量": [
                    { "name": "1月", "value": 1500 },
                    { "name": "2月", "value": 2200 },
                    { "name": "3月", "value": 1800 },
                    { "name": "4月", "value": 2800 },
                    { "name": "5月", "value": 2000 },
                    { "name": "6月", "value": 3500 }
                ]
            }
        ];
    }
    
    // 生成系列配置 - 确保是基础折线图
    generateSeries(dataDemo, seriesConfig) {
        const series = super.generateSeries(dataDemo, seriesConfig);
        
        // 确保关闭面积显示和平滑效果
        return series.map(s => ({
            ...s,
            smooth: false,
            areaStyle: undefined,
            stack: null
        }));
    }
}

// 定义自定义元素
customElements.define('basic-line-chart', BasicLineChart);
